package com.smcdd.cdb.dbo.cdb_dbo.ui.fragment;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.smcdd.cdb.dbo.cdb_dbo.R;
import com.smcdd.cdb.dbo.cdb_dbo.service.presenter.NotLayMenPresenter;
import com.smcdd.cdb.dbo.cdb_dbo.service.view.INotLayMenFg;
import com.smcdd.cdb.dbo.cdb_dbo.ui.activity.MenDianActivity;
import com.smcdd.cdb.dbo.cdb_dbo.ui.base.BaseFragmentFragment;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

/**
 * 作者：Administrator on 2017/6/20 12:01
 * 邮箱：zhanghuaiha@gmail.com
 * 待铺设
 */

public class NotLayMenFragment extends BaseFragmentFragment<INotLayMenFg,NotLayMenPresenter> implements INotLayMenFg {
    private RecyclerView mRcycler;

    @Override
    public void initView(View rootView) {
        EventBus.getDefault().register(this);
        mRcycler = (RecyclerView) rootView.findViewById(R.id.not_recycler);
    }


    @Override
    public void initData() {
        mPresenter.loadContacts();
    }

    @Override
    protected NotLayMenPresenter createPresenter() {
        return new NotLayMenPresenter((MenDianActivity) getActivity());
    }

    @Override
    protected int provideContentViewId() {
        return R.layout.fragment_not;
    }

    @Override
    public RecyclerView getRecycler() {
        return mRcycler;
    }

    @Override
    public MenDianActivity getMDActivity() {
        return (MenDianActivity)getActivity();
    }
    @Override
    public void onDestroy() {
        super.onDestroy();
        mPresenter.unLoadData();
        EventBus.getDefault().unregister(this);
    }

    //刷新
    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onRefresh(String event){
        if (event.equals("update")) {
            mPresenter.loadData();
        }
    }



}
